package com.amlyc.demo1;

public class TestThread4 implements Runnable{

    private int ticketNums=10;

    @Override
    public void run() {
        while (true) {
            System.out.println(Thread.currentThread().getName()+"--->get:"+ticketNums--);
            if (ticketNums <= 0) {
                break;
            }
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        TestThread4 testThread4 = new TestThread4();
        new Thread(testThread4,"a").start();
        new Thread(testThread4,"b").start();
        new Thread(testThread4,"c").start();
    }
}
